package GrampasGames.splash.client;

public class GameData {
	private String playerOneName = "Player One";
	private String playerTwoName = "Player Two";
	private int currentPlayer = 10;
	private int data [] = {0,0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0,
			0,0,0,0,0,0,0,0};// 0 not picked yet, 1-9 colour, 10 playerOne, 11 playerTwo
	private int playerOneScore=0;
	private int playerTwoScore=0;
	private String [] image = {"image/pickme.png",//0
			"image/one.png",//1
			"image/two.png",//2
			"image/three.png",//3
			"image/four.png",//4
			"image/five.png",//5
			"image/six.png",//6
			"image/seven.png",//7
			"image/eight.png",//8	
			"image/nine.png",//9	
			"image/croc.png",//10
			"image/tiger.png"//11
			}; // put matching images here as url strings
		
	public GameData(){	
	}// nothing done in constructor
	
	public void reset(){
		for (int i=0; i<65;i++){
			data[i]=0;
		}
		playerOneScore=0;
		playerTwoScore=0;
		currentPlayer=10;
	}
	
	public void incByThree(int i){
		if(data[i]< 10){
		data[i]= data[i]+3;
		if (data[i] >= 10){
			data[i]=this.currentPlayer;
			if(this.currentPlayer == 10){
				this.playerOneScore++;
				}else{
					this.playerTwoScore++;
				}
			}
		}
	}
	
	public void incByTwo(int i){
		if(data[i]< 10){
		data[i]= data[i]+2;
		if (data[i] >= 10){
			data[i]=this.currentPlayer;
			if(this.currentPlayer == 10){
				this.playerOneScore++;
				}else{
					this.playerTwoScore++;
				}
			}
		}
	}
	
	public void incByOne(int i){
		if(data[i]< 10){
		data[i]++;
		if (data[i] >= 10){
			data[i]=this.currentPlayer;
			if(this.currentPlayer == 10){
				this.playerOneScore++;
				}else{
					this.playerTwoScore++;
				}
			}
		}
	}
	
	public String getImage(int i) {
		return image[i];
	}

	public int getData( int i) {
		return data[i];
	}

	public void setData(int i, int data) {
		this.data [i] = data;
	}

	public int getPlayerOneScore() {
		return playerOneScore;
	}

	public void setPlayerOneScore(int playerOneScore) {
		this.playerOneScore = playerOneScore;
	}
	
	public void incPlayerOneScore(){
		this.playerOneScore++;
	}

	public int getPlayerTwoScore() {
		return playerTwoScore;
	}

	public void setPlayerTwoScore(int playerTwoScore) {
		this.playerTwoScore = playerTwoScore;
	}
	
	public void incPlayerTwoScore(){
		this.playerTwoScore++;
	}
	
	public String getCurrentPlayerName(){
		if(this.currentPlayer == 10){
			return this.playerOneName;
		}else{
			return this.playerTwoName;
		}
	}
	
	public void swapCurrentPlayer(){
		if(this.currentPlayer == 10){
			this.currentPlayer = 11;
		}else{
			this.currentPlayer = 10;
		}
	}
	
	public int getCurrentPlayerScore(){
		if(this.currentPlayer == 10){
			return this.playerOneScore;
		}else{
			return this.playerTwoScore;
		}
	}

	public String getPlayerOneName() {
		return playerOneName;
	}

	public void setPlayerOneName(String playerOneName) {
		this.playerOneName = playerOneName;
	}

	public String getPlayerTwoName() {
		return playerTwoName;
	}

	public void setPlayerTwoName(String playerTwoName) {
		this.playerTwoName = playerTwoName;
	}
	
	public int getCurrentPlayer() {
		return currentPlayer;
	}

	public void setCurrentPlayer(int currentPlayer) {
		this.currentPlayer = currentPlayer;
	}
}
